package com.kailing.bootBatch.thread;

/**
 * <h3>partitionjob</h3>
 * <p>fooBarMain</p>
 *
 * @author : hduong
 * @version : 1.0
 * @date : 2019-12-18 10:18
 **/
public class FooBarMain {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.print("foo");
            }
        }, "线程一");
        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.print("bar");
            }
        }, "线程二");

//        FooBar fooBar = new FooBar(2);
//        fooBar.foo(t1);
//        fooBar.bar(t2);

        FooBar2 fooBar2 = new FooBar2(2);
//        fooBar2.foo(t1);
//
//        new Thread(() -> {
//            try {
//                fooBar2.foo(t1);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }).start();
////        fooBar2.bar(t2);
//
//        new Thread(() -> {
//            try {
//                fooBar2.bar(t2);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }).start();

        FooBar3 fooBar3 = new FooBar3(2);
//        fooBar3.foo();
//        fooBar3.bar();
        new Thread(()->fooBar3.foo()).start();
        new Thread(()->fooBar3.bar()).start();

    }
}
